import http from '@/components/common/tui-request'


//新增工程质量整改
export const addQualityRectification = (projectId,data) => {
	return http.request({
		url: `/quality-rectification/addQualityRectification/${projectId}`,
		data:data,
		method: 'POST',
	});
};

//删除质量整改
export const deleteUnsubQualityRectification = (qualityRectificationId) => {
	return http.request({
		url: `/quality-rectification/deleteUnsubQualityRectification/${qualityRectificationId}`,
		method: 'POST',
	});
};

//编辑质量检查
export const updateQualityRectification = (data) => {
	return http.request({
		url: `/quality-rectification/updateQualityRectification`,
		data:data,
		method: 'PUT',
	});
};

//获取发起人质量整改列表
export const getQualityRectificationList = (projectId,page,limit) => {
	return http.request({
		url: `/quality-rectification/getQualityRectificationList/${projectId}/${page}/${limit}`,
		method: 'GET',
	});
};

//获取代办或已办
export const getTask = (projectId) => {
	return http.request({
		url: `/quality-rectification/getTask/${projectId}`,
		method: 'GET',
	});
};

//获取质量检查列表
export const getQualityList = (projectId,page,limit) => {
	return http.request({
		url: `/quality/getQualityList/${projectId}/${page}/${limit}`,
		method: 'GET',
	});
};

// 上传质量整改附件
export const uploadQualityRectificationAttach = (file) => {
	return uni.uploadFile({
		url: 'http://192.168.1.127:8086/quality-rectification/uploadQualityRectificationAttach',
		filePath: file.objectUrl,
		name: 'files',
		header: {'Authorization': uni.getStorageSync('token')}
	});
};

//删除质量整改附件
export const deleteQualityRectificationFile = (fileId) => {
	return http.request({
		url: `/quality-rectification-file/deleteQualityRectificationFile/${fileId}`,
		method: 'DELETE',
	});
};

//获取不合格质量检查信息
export const getAssociatedQualityList = (projectId) => {
	return http.request({
		url: `/quality-rectification/getAssociatedQualityList/${projectId}`,
		method: 'GET',
	});
};

//根据id回显数据
export const getQualityRectificationInfoById = (qualityRectificationId) => {
	return http.request({
		url: `/quality-rectification/getQualityRectificationInfoById?qualityRectificationId=${qualityRectificationId}`,
		method: 'GET',
	});
};

//审批
export const qualityRectificationReview = (data) => {
	return http.request({
		url: `/quality-rectification/qualityRectificationReview`,
		data:data,
		method: 'POST',
		data:data,
		method: 'POST',
	});
};

//送审
export const startQualityRectificationProcess = (qualityRectificationId) => {
	return http.request({
		url: `/quality-rectification/startQualityRectificationProcess?qualityRectificationId=${qualityRectificationId}`,
		method: 'POST',
	});
};

//质量整改处理
export const qualityRectificationDispose = (data) => {
	return http.request({
		url: '/quality-rectification/qualityRectificationDispose',
		data:data,
		method: 'POST',
	});
};

//获取当前企业参建人员下拉列表信息
export const projectUserManageList = (projectId,unitsId) => {
	return http.request({
		url: `/project-user/projectUserManageList?projectId=${projectId}&unitsId=${unitsId}`,
		method: 'GET',
	});
};

//获取新增时检查人员下拉列表名单
export const getQualityMemberNameList = () => {
	return http.request({
		url: '/quality/getQualityMemberNameList',
		method: 'GET',
	});
};

//根据质量整改id查询质量整改信息
export const getQualityRectificationProcessById = (qualityRectificationId) => {
	return http.request({
		url: `/quality-rectification/getQualityRectificationProcessById?qualityRectificationId=${qualityRectificationId}`,
		method: 'GET',
	});
};

//获取质量整改详情
export const selectQualityRectificationById = (qualityRectificationId) => {
	return http.request({
		url: `/quality-rectification/selectQualityRectificationById?qualityRectificationId=${qualityRectificationId}`,
		method: 'GET',
	});
};